# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=fern-wifi-cracker
_pkgname=Fern-Wifi-Cracker
pkgver=301.eff2eb7
pkgrel=4
groups=('blackarch' 'blackarch-wireless' 'blackarch-cracker')
pkgdesc='WEP, WPA wifi cracker for wireless penetration testing.'
arch=('any')
url='http://code.google.com/p/fern-wifi-cracker/'
license=('GPL2')
depends=('python' 'python-pyqt5' 'aircrack-ng' 'xterm' 'subversion'
         'python-scapy' 'macchanger')
makedepends=('git')
source=("git+https://github.com/savio-code/$pkgname.git"
        'remove-update.patch')
sha512sums=('SKIP'
            '16b33ac75e72c8dd0ce4710ae2bf5d897026732c259afa53b95951447a9d909ced2d0423fdf4317bcbdd461ef6dc86d594f202e9d989e09e44c52f3b6eda2456')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd "$pkgname/$_pkgname"

  patch -p2 < ../../remove-update.patch
}

package() {
  cd "$pkgname/$_pkgname"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/Settings"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python ./execute.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

